package v3.chapter7.stateTest1;

public class Run {

	public static void main(String[] args) {
		try {
			MyThread t=new MyThread();
			System.out.println("main方法中的状态1：" + t.getState()+" 当前线程名称："+Thread.currentThread().getName());
			Thread.sleep(1000);
			t.start();
			System.out.println(t.getName());
			Thread.sleep(1000);
			System.out.println("main方法中的状态2：" + t.getState()+" 当前线程名称："+Thread.currentThread().getName());
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
	}

}

class MyThread extends Thread{
	public MyThread() {
		System.out.println("构造方法中的状态：" + Thread.currentThread().getState());
		System.out.println("当前线程名称："+Thread.currentThread().getName());
	}

	@Override
	public void run() {
		System.out.println("run方法中的状态：" + Thread.currentThread().getState());
		System.out.println("当前线程名称："+Thread.currentThread().getName());
	} 
}